package com.spark.client.model;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * 星火大模型消息类
 */
public class SparkMessage {
    
    /**
     * 角色：user、assistant、system、tool
     */
    private String role;
    
    /**
     * 消息内容
     */
    private String content;
    
    /**
     * 工具调用ID（用于 tool 角色）
     */
    @JsonProperty("tool_call_id")
    private String toolCallId;

    public SparkMessage() {}

    public SparkMessage(String role, String content) {
        this.role = role;
        this.content = content;
    }

    public SparkMessage(String role, String content, String toolCallId) {
        this.role = role;
        this.content = content;
        this.toolCallId = toolCallId;
    }

    // 静态工厂方法
    public static SparkMessage user(String content) {
        return new SparkMessage("user", content);
    }

    public static SparkMessage assistant(String content) {
        return new SparkMessage("assistant", content);
    }

    public static SparkMessage system(String content) {
        return new SparkMessage("system", content);
    }

    public static SparkMessage tool(String content, String toolCallId) {
        return new SparkMessage("tool", content, toolCallId);
    }

    // Getters and Setters
    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getToolCallId() {
        return toolCallId;
    }

    public void setToolCallId(String toolCallId) {
        this.toolCallId = toolCallId;
    }

    @Override
    public String toString() {
        return "SparkMessage{" +
                "role='" + role + '\'' +
                ", content='" + content + '\'' +
                ", toolCallId='" + toolCallId + '\'' +
                '}';
    }
}
